package com.liuqi.knet.remoting;

/**
 * 通道IO事件处理器
 *
 * @author liuqi
 * @date 2024/12/17 15:47
 **/
public interface ChannelHandler {

    /**
     * 通道连接成功
     *
     */
    void connected(Channel channel) throws RemotingException;

    /**
     * 通道完成关闭
     *
     */
    void disconnected(Channel channel) throws RemotingException;

    /**
     * 通道写入消息
     *
     */
    void send(Channel channel, Object message) throws RemotingException;

    /**
     * 通道接收消息
     *
     */
    void received(Channel channel, Object message) throws RemotingException;

    /**
     * 通道异常
     *
     */
    void caught(Channel channel, Throwable exception) throws RemotingException;

}
